/*
package createThread.DemoTest;

*/
/**
 * @author wang'ji'cheng
 * @date 2025/8/7
 *//*

public class Demo01 {
    static final Object obj = new Object();

    static int i = 0;

    static Thread1 t1 = new Thread1(() -> {
        while (i <100) {
            synchronized (obj) {
                obj.notify();
                i++;
                System.out.println(Thread1.currentThread().getName()+"打印了："+i);
                try {
                    if(i<100){
                        obj.wait();
                    }
                } catch (InterruptedException e) {
                   e.printStackTrace();
                }

            }
        }
    });
    static Thread1 t2 = new Thread1(() -> {
        while (i < 100) {
            synchronized (obj) {
                obj.notify();
                i++;
                System.out.println(Thread1.currentThread().getName()+"打印了："+i);
                try {
                    if(i<100){
                        obj.wait();
                    }
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                obj.notify();
            }
        }
    });

    public static void main(String[] args) {
        t1.start();
        t2.start();
    }

}
*/
